package com.liujg.future.config;

import io.minio.MinioClient;
import lombok.Data;
import org.springframework.boot.context.properties.ConfigurationProperties;
import org.springframework.context.annotation.Bean;
import org.springframework.context.annotation.Configuration;
import org.springframework.stereotype.Component;

/**
 * @author Lannibar
 * @date: 2023-5-17
 * @Description minio配置
 */
@Configuration
@Component
@ConfigurationProperties(prefix = "minio")
@Data
public class MinioConfig {

    private String endpoint;

    private int port;

    private String accessKey;

    private String secretKey;

    private Boolean secure;

    private String bucketName;

    @Bean
    public MinioClient getMinioClient(){
        return MinioClient.builder().endpoint(endpoint,port,false)
                .credentials(accessKey, secretKey)
                .build();
    }

}
